<?php


use Phinx\Seed\AbstractSeed;
use Faker\Factory as FakerFactory;

class TagSeeder extends AbstractSeed
{
    /**
     * Run Method.
     *
     * Write your database seeder using this method.
     *
     * More information on writing seeders is available here:
     * https://book.cakephp.org/phinx/0/en/seeding.html
     */
    public function run()
    {
        $faker = FakerFactory::create('zh_CN');

        $rows = [];
        foreach ($this->getTagNames() as $name) {
            $rows[] = [
                'name' => $name,
                'icon' => $faker->imageUrl(96, 96),
                'priority' => 100,
                'published' => 1,
                'follow_count' => $faker->numberBetween(1001, 9999),
                'create_time' => $faker->unixTime,
                'update_time' => $faker->unixTime,
            ];
        }

        $this->table('kg_tag')->insert($rows)->saveData();
    }

    protected function getTagNames(): array
    {
        return [
            'HTML/CSS',
            'JavaScript',
            '小程序',
            '自然语言处理',
            'jQuery',
            'Node.js',
            'Bootstrap',
            'Angular',
            'React.js',
            'Vue.js',
            'Sass/Less',
            'WebApp',
            '前端工具',
            'PHP',
            'Java',
            'Python',
            'C语言',
            'C++',
            'Ruby',
            'Go',
            'C#',
            'Android',
            'IOS',
            'Unity 3D',
            'Cocos2d-x',
            'MySQL',
            'MongoDB',
            'Redis',
            'Oracle',
            '机器学习',
            '深度学习',
            '云计算',
            '大数据',
            '测试',
            '运维',
            '动画特效',
            '设计工具',
            '设计基础',
            'PostgreSQL',
            '微服务',
            '数据分析',
            '区块链',
            '网络',
            '算法',
            '数学',
            '物理',
        ];
    }

}
